package com.shareach.domain;

public enum DiscountType {
	None(0,"None","错误"),
	Ticket(1,"tkt","优惠券"),
	Tuan(2,"tuan","团购"),
	Card(3,"card","卡折"),
	Activity(4,"act","银行活动"),
	Weibo(5,"weibo","微博")
	;
	private final int value;
	private final String code;
	private final String text;
	
	DiscountType(int value, String code,String text) {
		this.value = value;
		this.text = text;
		this.code= code;
	}
	public int getValue() {
		return this.value;
	}
	public String getCode(){
		return this.code;
	}
	public String getText(){
		return this.text;
	}
	
	public static DiscountType get(int value) {
		for (DiscountType src : DiscountType.values()) {
			if (value == src.value) {
				return src;
			}
		}
		return DiscountType.None;
	}
	public static DiscountType get(String code){
		for (DiscountType src : DiscountType.values()) {
			if (src.getCode().equals(code)) {
				return src;
			}
		}
		return DiscountType.None;
	}
}
